.class public Lorg/zeam/DotsIndicator;
.super Landroid/view/ViewGroup;
.source "DotsIndicator.java"


# instance fields
.field private mCurrentItem:I

.field private mDotDrawableId:I

.field private mTotalItems:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 21
    invoke-direct {p0, p1}, Landroid/view/ViewGroup;-><init>(Landroid/content/Context;)V

    .line 22
    invoke-direct {p0}, Lorg/zeam/DotsIndicator;->init()V

    .line 23
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 16
    invoke-direct {p0, p1, p2}, Landroid/view/ViewGroup;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 17
    invoke-direct {p0}, Lorg/zeam/DotsIndicator;->init()V

    .line 18
    return-void
.end method

.method private createLayout()V
    .locals 21

    .prologue
    .line 56
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->detachAllViewsFromParent()V

    .line 57
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getResources()Landroid/content/res/Resources;

    move-result-object v17

    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mDotDrawableId:I

    move/from16 v18, v0

    invoke-virtual/range {v17 .. v18}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v17

    invoke-virtual/range {v17 .. v17}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v8

    .line 58
    .local v8, dotWidth:I
    move v14, v8

    .line 59
    .local v14, separation:I
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getWidth()I

    move-result v17

    div-int/lit8 v17, v17, 0x2

    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    move/from16 v18, v0

    mul-int v18, v18, v8

    div-int/lit8 v18, v18, 0x2

    .line 60
    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    move/from16 v19, v0

    const/16 v20, 0x1

    sub-int v19, v19, v20

    mul-int v19, v19, v14

    div-int/lit8 v19, v19, 0x2

    add-int v18, v18, v19

    .line 59
    sub-int v12, v17, v18

    .line 62
    .local v12, marginLeft:I
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getHeight()I

    move-result v17

    div-int/lit8 v17, v17, 0x2

    div-int/lit8 v18, v8, 0x2

    sub-int v13, v17, v18

    .line 64
    .local v13, marginTop:I
    const/4 v9, 0x0

    .local v9, i:I
    :goto_0
    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    move/from16 v17, v0

    move v0, v9

    move/from16 v1, v17

    if-lt v0, v1, :cond_0

    .line 93
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->postInvalidate()V

    .line 94
    return-void

    .line 66
    :cond_0
    new-instance v7, Landroid/widget/ImageView;

    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getContext()Landroid/content/Context;

    move-result-object v17

    move-object v0, v7

    move-object/from16 v1, v17

    invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 68
    .local v7, dotImageView:Landroid/widget/ImageView;
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getResources()Landroid/content/res/Resources;

    move-result-object v17

    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mDotDrawableId:I

    move/from16 v18, v0

    invoke-virtual/range {v17 .. v18}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v16

    check-cast v16, Landroid/graphics/drawable/TransitionDrawable;

    .line 70
    .local v16, transitionDrawable:Landroid/graphics/drawable/TransitionDrawable;
    const/16 v17, 0x1

    invoke-virtual/range {v16 .. v17}, Landroid/graphics/drawable/TransitionDrawable;->setCrossFadeEnabled(Z)V

    .line 71
    move-object v0, v7

    move-object/from16 v1, v16

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 73
    new-instance v10, Landroid/view/ViewGroup$LayoutParams;

    .line 74
    const/16 v17, -0x1

    const/16 v18, -0x1

    .line 73
    move-object v0, v10

    move/from16 v1, v17

    move/from16 v2, v18

    invoke-direct {v0, v1, v2}, Landroid/view/ViewGroup$LayoutParams;-><init>(II)V

    .line 76
    .local v10, layoutParams:Landroid/view/ViewGroup$LayoutParams;
    invoke-virtual {v7, v10}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 78
    const/16 v17, 0x0

    .line 77
    move v0, v8

    move/from16 v1, v17

    invoke-static {v0, v1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v17

    .line 78
    const/16 v18, 0x0

    move-object v0, v10

    iget v0, v0, Landroid/view/ViewGroup$LayoutParams;->height:I

    move/from16 v19, v0

    .line 77
    invoke-static/range {v17 .. v19}, Lorg/zeam/DotsIndicator;->getChildMeasureSpec(III)I

    move-result v5

    .line 80
    .local v5, childHeightSpec:I
    const/high16 v17, 0x4000

    .line 79
    move v0, v8

    move/from16 v1, v17

    invoke-static {v0, v1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v17

    .line 80
    const/16 v18, 0x0

    move-object v0, v10

    iget v0, v0, Landroid/view/ViewGroup$LayoutParams;->width:I

    move/from16 v19, v0

    .line 79
    invoke-static/range {v17 .. v19}, Lorg/zeam/DotsIndicator;->getChildMeasureSpec(III)I

    move-result v6

    .line 82
    .local v6, childWidthSpec:I
    invoke-virtual {v7, v6, v5}, Landroid/widget/ImageView;->measure(II)V

    .line 83
    add-int v17, v8, v14

    mul-int v17, v17, v9

    add-int v11, v12, v17

    .line 84
    .local v11, left:I
    add-int v17, v11, v8

    add-int v18, v13, v8

    move-object v0, v7

    move v1, v11

    move v2, v13

    move/from16 v3, v17

    move/from16 v4, v18

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/widget/ImageView;->layout(IIII)V

    .line 85
    invoke-virtual/range {p0 .. p0}, Lorg/zeam/DotsIndicator;->getChildCount()I

    move-result v17

    const/16 v18, 0x1

    move-object/from16 v0, p0

    move-object v1, v7

    move/from16 v2, v17

    move-object v3, v10

    move/from16 v4, v18

    invoke-virtual {v0, v1, v2, v3, v4}, Lorg/zeam/DotsIndicator;->addViewInLayout(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;Z)Z

    .line 87
    move-object/from16 v0, p0

    iget v0, v0, Lorg/zeam/DotsIndicator;->mCurrentItem:I

    move/from16 v17, v0

    move v0, v9

    move/from16 v1, v17

    if-ne v0, v1, :cond_1

    .line 88
    invoke-virtual {v7}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v15

    check-cast v15, Landroid/graphics/drawable/TransitionDrawable;

    .line 89
    .local v15, tmp:Landroid/graphics/drawable/TransitionDrawable;
    const/16 v17, 0xc8

    move-object v0, v15

    move/from16 v1, v17

    invoke-virtual {v0, v1}, Landroid/graphics/drawable/TransitionDrawable;->startTransition(I)V

    .line 64
    .end local v15           #tmp:Landroid/graphics/drawable/TransitionDrawable;
    :cond_1
    add-int/lit8 v9, v9, 0x1

    goto/16 :goto_0
.end method

.method private init()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 27
    invoke-virtual {p0, v0}, Lorg/zeam/DotsIndicator;->setFocusable(Z)V

    .line 28
    invoke-virtual {p0, v0}, Lorg/zeam/DotsIndicator;->setWillNotDraw(Z)V

    .line 29
    const v0, 0x7f02001b

    iput v0, p0, Lorg/zeam/DotsIndicator;->mDotDrawableId:I

    .line 30
    return-void
.end method

.method private updateLayout()V
    .locals 4

    .prologue
    .line 43
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    invoke-virtual {p0}, Lorg/zeam/DotsIndicator;->getChildCount()I

    move-result v3

    if-lt v0, v3, :cond_0

    .line 52
    return-void

    .line 44
    :cond_0
    invoke-virtual {p0, v0}, Lorg/zeam/DotsIndicator;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageView;

    .line 45
    .local v1, imageView:Landroid/widget/ImageView;
    invoke-virtual {v1}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v2

    check-cast v2, Landroid/graphics/drawable/TransitionDrawable;

    .line 46
    .local v2, transitionDrawable:Landroid/graphics/drawable/TransitionDrawable;
    iget v3, p0, Lorg/zeam/DotsIndicator;->mCurrentItem:I

    if-ne v0, v3, :cond_1

    .line 47
    const/16 v3, 0x32

    invoke-virtual {v2, v3}, Landroid/graphics/drawable/TransitionDrawable;->startTransition(I)V

    .line 43
    :goto_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 49
    :cond_1
    invoke-virtual {v2}, Landroid/graphics/drawable/TransitionDrawable;->resetTransition()V

    goto :goto_1
.end method


# virtual methods
.method protected getCurrentItem()I
    .locals 1

    .prologue
    .line 109
    iget v0, p0, Lorg/zeam/DotsIndicator;->mCurrentItem:I

    return v0
.end method

.method protected getTotalItems()I
    .locals 1

    .prologue
    .line 97
    iget v0, p0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    return v0
.end method

.method protected onLayout(ZIIII)V
    .locals 1
    .parameter "changed"
    .parameter "l"
    .parameter "t"
    .parameter "r"
    .parameter "b"

    .prologue
    .line 35
    iget v0, p0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    if-gtz v0, :cond_0

    .line 39
    :goto_0
    return-void

    .line 38
    :cond_0
    invoke-direct {p0}, Lorg/zeam/DotsIndicator;->createLayout()V

    goto :goto_0
.end method

.method protected setCurrentItem(I)V
    .locals 1
    .parameter "currentItem"

    .prologue
    .line 113
    iget v0, p0, Lorg/zeam/DotsIndicator;->mCurrentItem:I

    if-eq p1, v0, :cond_0

    .line 114
    iput p1, p0, Lorg/zeam/DotsIndicator;->mCurrentItem:I

    .line 115
    invoke-direct {p0}, Lorg/zeam/DotsIndicator;->updateLayout()V

    .line 117
    :cond_0
    return-void
.end method

.method protected setTotalItems(I)V
    .locals 1
    .parameter "totalItems"

    .prologue
    .line 102
    iget v0, p0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    if-eq p1, v0, :cond_0

    .line 103
    iput p1, p0, Lorg/zeam/DotsIndicator;->mTotalItems:I

    .line 104
    invoke-direct {p0}, Lorg/zeam/DotsIndicator;->createLayout()V

    .line 106
    :cond_0
    return-void
.end method
